const { task, watch, series, src, dest } = require('gulp')
const gulpScss = require('gulp-sass')
const webserver = require('gulp-webserver')

function scss(cb) {
  return src('src/scss/*.scss')
    .pipe(gulpScss())
    .pipe(dest('src/css/'))
  // place code for your default task here
  cb();
}

function webServer(cb){
  src('src')
    .pipe(webserver({
      livereload: true,
      directoryListing: true,
      open: true
    }))
  cb()
}

// 可以只关联一个任务
watch('src/scss/*.scss', scss);
// 或者关联一个任务组合
// watch('src/*.js', series(clean, javascript));

exports.default = series(webServer, scss)